const mongoose = require('mongoose')
const goodSchema = new mongoose.Schema({
    user: { //关联的用户
        type: mongoose.Schema.Types.ObjectId,
        ref: 'user'
    },
    goodname: { //商品名称
        type: String,
        required: true
    },
    goodinfo: { //商品描述
        type: String,
        default: ''
    },
    price: { //商品价格
        type: String,
        default: 0
    },
    address: { //地址
        type: String,
        default: ''
    },
    img: { //商品图片
        type: Array,
        default: []
    },
    type: { //商品类型
        type: String,
        default: ''
    },
    click: { //点击量
        type: Number,
        default: 0
    },
    collections: { //收藏量
        type: Array,
        default: []
    }
})

module.exports = mongoose.model('good', goodSchema)